import 'package:flutter/material.dart';

class Animated3Page extends StatefulWidget {

  const Animated3Page({super.key});

  @override
  State<Animated3Page> createState() => _Animated3PageState();

}

class _Animated3PageState extends State<Animated3Page> with SingleTickerProviderStateMixin{

  late AnimationController _controller;
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _controller = AnimationController(
      vsync: this,
      duration: Duration(seconds: 2),//持续时间
    )..repeat(reverse:  true);
  }

  @override
  void dispose() {
    // TODO: implement dispose
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: FloatingActionButton(
        onPressed: (){
          _controller.reset();
        },
        child: Icon(Icons.add),
      ),
      body: Center(
        child: ScaleTransition( //缩放动画
          scale: _controller,child: FlutterLogo(size: 120,),),
      ),
    );
  }
}
